using System;
using System.Threading;

namespace EventMsg;

public class EventMessage
{
	/// <summary>
	/// 消息名称
	/// </summary>
	public string MessageName { get; set; }

	/// <summary>
	/// 消息终止信号
	/// </summary>
	public ManualResetEventSlim EventSlim { get; set; }

	/// <summary>
	/// 消息内容
	/// </summary>
	public object MessageBody { get; set; }

	/// <summary>
	/// 消息执行时间
	/// </summary>
	public DateTime CreateTime { get; set; }

	/// <summary>
	/// 回复状态
	/// </summary>
	public EventEnum State { get; set; }

	/// <summary>
	/// 是否被释放
	/// </summary>
	public bool IsDispose { get; private set; }

	/// <summary>
	/// 错误信息
	/// </summary>
	public string ErrorMsg { get; set; }

	public void DisPose()
	{
		if (EventSlim != null)
		{
			EventSlim.Dispose();
			IsDispose = true;
		}
	}
}
